# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=py3-geoip2
pkgver=4.5.0
pkgrel=0
pkgdesc="API for the GeoIP2 web services and databases"
options="!check" # Requires unpackaged mocket
url="https://www.maxmind.com/en/home"
arch="noarch"
license="Apache-2.0"
depends="py3-requests py3-maxminddb py3-aiohttp py3-urllib3"
makedepends="python3-dev libmaxminddb-dev py3-setuptools"
checkdepends="py3-nose py3-mock"
_test_data_commit=cbaa463dc6950ababbf678ca85fb3833b81c76d3
source="$pkgname-$pkgver.tar.gz::https://github.com/maxmind/GeoIP2-python/archive/v$pkgver.tar.gz
	MaxMind-DB-test-data-$_test_data_commit.tar.gz::https://github.com/maxmind/MaxMind-DB/archive/$_test_data_commit.tar.gz"
builddir="$srcdir/GeoIP2-python-$pkgver"

prepare() {
	cd "$srcdir"

	# Submodule required for tests
	cp -r "MaxMind-DB-$_test_data_commit/"* "$builddir/tests/data"
	default_prepare
}

build() {
	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
a3701b7dbaf3c5b20b0f2b19742ecbb36da806fc7e156dc64852a2cdd9cfab2dfba47367b15bbe848016f36d20b30e91dc662e41e730d15476372cd872c01cd7  py3-geoip2-4.5.0.tar.gz
337552c1d6524ba31c1d3df55c0b6137ca2d5115529b8c1a619c82baa198886c274bac4228e456273851bddc46ca983ad2be6329b8f19d2769b745fb2c0f96b1  MaxMind-DB-test-data-cbaa463dc6950ababbf678ca85fb3833b81c76d3.tar.gz
"
